<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRewardTransactionsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('reward_transactions', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户id');
            $table->decimal('amount', 18, 2)->default(0)->comment('交易金额');
            $table->decimal('balance', 18, 2)->default(0)->comment('交易后余额');
            $table->tinyInteger('transaction_type')->default(0)->comment('1-释放获取, 2-分佣获取 ,3-提现, 4-转换');
            $table->tinyInteger('status')->default(1)->comment('1-处理中, 2-成功, 3-失败');
            $table->tinyInteger('change_type')->default(1)->comment('1-增加, 2-减少');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `reward_transactions` comment '奖励账户变动记录'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('reward_transactions');
    }
}
